<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<!-- matchAll用于批量获取数据 -->
<script>
  "use strict";
  let str = `<ul>
    <li>
      <a>好的呢</a>
      <p>卡看了</p>
    </li>
    <li>
      <a>好的呢</a>
      <p>卡看了</p>
    </li>
  </ul>`;
  const reg = /<li>.*?<a>(.*?)<\/a>.*?<p><\/p>/sg;
  const res = str.matchAll(reg);
  console.log(res);
  console.log(...res);
</script>

</html>